﻿// See https://aka.ms/new-console-template for more information

using CommonTools;
using CommonTools.Extension;
using Discord.Bot;
using YukariToolBox.LightLog;

string logInfo = AppConfigurationServices.Configuration["DiscordSetting:LOG_LEVEL"];
if (!string.IsNullOrEmpty(logInfo))
{
    if (Enum.TryParse(logInfo, out LogLevel level))
    {
        //设置log等级
        Log.LogConfiguration.EnableConsoleOutput().SetLogLevel(level);
    }
}

string token = AppConfigurationServices.Configuration["DiscordSetting:BOT_TOKEN"];
var client=new DiscordBotClient(token);
await client.StartService().RunCatch(e => Log.Error("Discord Service", Log.ErrorLogBuilder(e))); ;
await Task.Delay(-1);